import { createRouter, createWebHashHistory } from 'vue-router'
import { defineAsyncComponent } from 'vue'
const _import = (path) => defineAsyncComponent(() => import(`../pages/${path}.vue`));
import Index from '@/pages/index.vue'
const routes = [
    {   //跟路由
        path: '/',

        component: Index,
    },{ //登录路由
        path: '/login',
        name: 'Login',
        component:_import('login'),
    },{ //404路由 将匹配所有内容并将其放在 `$route.params.pathMatch` 下
        path: '/:pathMatch(.*)*',
        name: 'NotFound',
        component:_import('404'),
    }
]

const router = createRouter({
    history:createWebHashHistory(),
    routes
})
export default router
